﻿@model giaoxuhaison.Models.UploadFileModel

@{
    ViewBag.Title = "UploadFiles";
    Layout = "~/Views/Admin/_LayoutAdmin.cshtml";
}
<script type="text/javascript">
    function GetImage() {
        var filename = document.getElementById("file");
        var usertxtfilename = document.getElementById("txtfilename");
        var lblFiles = document.getElementById("labelFiles");
        usertxtfilename.value += filename.value + '|';
        lblFiles.innerHTML += filename.value + '<br>';
    }

    function createDir() {
        var choose = document.getElementById("choose");
        if (choose.value == '/Images/GXHS/') {
            document.getElementById("txtchoose").disabled = false;
        }
        else {
            document.getElementById("txtchoose").value = '';
            document.getElementById("txtchoose").disabled = true;
        }
        //alert(document.getElementById("txtchoose").disabled);
    }
</script>
@*<h2 style="color:blue; margin: 0px; padding: 0 0 20px 0; font-family: MS Reference Sans Serif, Tahoma, Arial, Courier New;">Upload hình lên máy chủ</h2>*@

@using (Html.BeginForm("UploadFile", "Admin", FormMethod.Post, new { encType = "multipart/form-data" }))
{
    @Html.ValidationSummary(true)
    <div class="Title">
        <img src="~/Images/lists.ico" align="absmiddle" />
        <bold>UPLOAD HÌNH LÊN SERVER</bold>
    </div>
    
    <div class="PanelBoder">
    </div>
    <div class="NewsAlls">
            <table style="width: 100%;">    
            <tr>
                <td style="text-align: right; width: 200px; padding-right: 10px;">
                    Chọn từ máy
                </td>
                <td style="text-align: left;">
                    <input type="file" name="FileContent" id="file" onchange="GetImage()"/>
                    @Html.ValidationMessageFor(model => model.FileContent)
                </td>
            </tr>
            <tr>
                <td style="text-align: right; width: 200px; padding-right: 10px;">
                    Tên hình
                </td>
                <td style="text-align: left;" >            
                    @*
                    @if (Model != null)
                    {
                        <input type="hidden" name="FileName" id="txtfilename1" value="@Model.FileName" />
                    }
                    else
                    {
                        <input type="hidden" name="FileName" id="txtfilename" value="" />
                    }
                    @Html.ValidationMessageFor(model => model.FileName)
                    *@
                </td>
            </tr>
            <tr>
                <td style="text-align: right; width: 200px; padding-right: 10px;">
            
                </td>
                <td style="text-align: left; color:Red;" id="labelFiles">
            
                    @*
                    @if (Model != null)
                    {
                        <input type="hidden" name="FileName" id="txtfilename1" value="@Model.FileName" />
                    }
                    else
                    {
                        <input type="hidden" name="FileName" id="txtfilename" value="" />
                    }
                    @Html.ValidationMessageFor(model => model.FileName)
                    *@
                </td>
            </tr>
            <tr>
                <td>
                    <input type="hidden" name="FileName" id="txtfilename" value="" />
                </td>
            </tr>
            <tr>
                <td style="text-align: right; width: 200px; padding-right: 10px;">
                    Loại tin tức
                </td>
                <td style="text-align: left;">
                    <select id="choose" name="SavePath" onchange="createDir()">
                        <option id="1" value="~/Images/Inform/">Mục Thông Báo</option>
                        <option id="2" value="~/Images/News/ContentImages/">Mục Tin Tức</option>
                        <option id="3" value="~/Images/SpecialNews/Happy/">Mục Tin Vui</option>
                        <option id="4" value="~/Images/SpecialNews/Sad/">Mục Tin Buồn</option>
                        <option id="5" value="~/Images/GodTitle/">Mục Suy Niệm Lời Chúa</option>
                        <option id="6" value="~/Images/Liturgies/">Mục Phụng Vụ</option>
                        <option id="7" value="~/Images/Failth/">Mục Sống Đức Tin</option>
                        <option id="8" value="~/Images/Bibles/">Mục Thánh Kinh</option>
                        <option id="9" value="~/Images/Culture/">Mục Văn Hóa</option>
                        <option id="10" value="~/Images/GXHS/">Mục Hình Ảnh</option>                        
                        <option id="11" value="~/Images/Category/">Mục Danh Mục</option>                        
                    </select>
                </td>
            </tr>
            <tr>
                <td style="text-align: right; width: 200px; padding-right: 10px;">
                    Thu muc
                </td>
                <td style="text-align: left;">
                    <input type="text" name="Folder" id="txtchoose" value="" disabled="disabled"/>
                </td>
            </tr>
            <tr>
                <td>
            
                </td>
                <td style="text-align: left;">
                    <input type="submit" name="btnOK" id="btnOK" value="Upload" />
                </td>
            </tr>
        </table>
</div>
}